<template>
	<!-- 器官设置 -->
	<div class="page-wrap">
		<div class="page-content p-0">
			<div class="page-column p-0">
				<div class="page-form p-x-0">
					<el-form
						:model="ruleForm"
						:rules="rules"
						label-position="left"
						label-width="140px"
						ref="form"
						label-suffix="："
					>
						<el-row>
							<el-col :span="24">
								<el-form-item label="DCF文件" prop="DCF_FILE001">
									<select-para
										size="medium"
										class="mediumForm"
										v-model="ruleForm.DCF_FILE001"
										:label.sync="ruleForm.DCF_FILE001"
										:options="DCF_FILE001options"
									></select-para>
								</el-form-item>
							</el-col>
						</el-row>
					</el-form>
				</div>
				<div class="bottom-btn">
					<el-button type="primary" :loading="loading" @click="submitFun">下一步</el-button>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import selectPara from "@/components/selectPara"
import commCheckbox from "@/components/commCheckbox"
import ImageCropper from "@/components/ImageCropper"
import FixBottomButton from "@/components/FixBottomButton"
import ueditor from "@/components/ueditor"
import textLength from "@/components/common/comp/textLength"
import { commPara } from "@/mixins/mixins"
import { mapState } from "vuex"
// import {
//     saveslbaseinfo,
//     slbaseinfo
// } from '../service.js';
export default {
	name: "aboutUs",
	props: {},
	mixins: [commPara],
	components: {
		selectPara,
		ImageCropper,
		textLength,
		commCheckbox,
		FixBottomButton,
		ueditor,
	},

	data() {
		return {
			activeTab: "2",
			ruleForm: {
				SRCRIORG001: "",
				DCF_FILE001: "",
			},
			rules: {
				DCF_FILE001: [
					{
						required: true,
						message: "请选择",
						trigger: "change",
					},
				],
			},
			DCF_FILE001options: [
				{
					label: "DOSD60.INP",
					value: "DOSD60.INP",
				},
				{
					label: "DOSD825.INP",
					value: "DOSD825.INP",
				},
				{
					label: "DOSDATA.INP",
					value: "DOSDATA.INP",
				},
				{
					label: "DOSDATA.NEW",
					value: "DOSDATA.NEW",
				},
			],

			loading: false,
		}
	},
	created() {
		// this.queryDetail()
	},
	computed: {
		...mapState({
			ingestion_Data: (state) => state.token.ingestion_Data,
		}),
	},
	methods: {
		setData() {
			this.ruleForm.DCF_FILE001 = this.ingestion_Data.DCF_FILE001
				? this.ingestion_Data.DCF_FILE001.toString()
				: "DOSD60.INP"
		},
		submitFun() {
			//保存
			this.$refs.form.validate((valid) => {
				if (valid) { 
					let tempdata = JSON.parse(
						JSON.stringify(this.ingestion_Data)
					)
					tempdata.DCF_FILE001 = this.ruleForm.DCF_FILE001
					tempdata.SETPAGEINDEX = this.activeTab
					this.$store.dispatch("upData_ingestion_Data", tempdata)
					let params = {
						batchid: this.$route.query.id,
						batchinfo: "SHIRU",
						submitjson: JSON.stringify(tempdata),
					}
					// console.log(params)
					this.$appApi
						.BATCH_SUBMIT(params)
						.then((res) => {
							var str = res.data.substring(0, 1)
							if (str == "E") {
								let message = res.data.substring(6)
								this.$notify.error({
									title: "提交失败！",
									message: message,
									type: "success",
								})
							} else if (str == "S") {
								this.$notify({
									message: "提交成功！",
									type: "success",
								})
							}
						})
						.catch((err) => {
							console.log(err)
						})

					this.$emit("changeActiveTab", this.activeTab)
					this.$store.dispatch(
						"change_ingestion_showTab",
						this.activeTab
					)
				}
			})
		},
	},
}
</script>
<style lang="scss" scoped>
.page-flex-row /deep/ .el-collapse-item__header {
	background: #f3f9fe;
}
.apparatusListItem {
	width: 550px;
	height: 150px;
	display: flex;
	justify-content: space-around;
	align-items: center;
	box-shadow: 0px 0px 5px #ccc;
	margin: 10px;
	padding: 20px;
	.apparatusItem {
		height: 110px;
	}
	i {
		font-size: 20px;
	}
}
</style>